package com.yang.jpa.dao;

import com.yang.jpa.model.CheckAttendanceSheet;
import com.yang.jpa.model.Staff;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StaffDao extends JpaRepository<Staff, Integer>, JpaSpecificationExecutor<Staff> {

    @Query(value = "select s.* from staff s inner join attendance_sheet a on a.staff_id = s.id inner join check_attendance_sheet cas on cas.attendance_sheet_id = a.id where cas.id = ?", nativeQuery = true)
    Staff findStaff(Integer checkAttendanceSheetId);

}
